﻿-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[ExecuteRafikiNOSQL]
	@NOSQL nvarchar(max) = '',
	@JSONParameters nvarchar(MAX) = '',
	@SD datetime = NULL,
	@ED datetime = NULL,
	@TD nvarchar(100) = '' -- SHORT NAME for a TIMEDIV or CURRENT.timedivtype, PREV.timedivtype, or NEXT.timedivtype

AS
BEGIN

DECLARE @plainsql nvarchar(max)
SET @plainsql = [dbo].[ConvertRafikiNOSQL]  (@NOSQL,@JSONParameters,@SD,@ED,@TD)
IF(CHARINDEX('Error: ',@plainsql) = 0)
	EXECUTE( @plainsql)
ELSE
	SELECT @plainsql AS Error
END